/*************************************************************************
	> File Name: person.h
	> Author: ma6174
	> Mail: ma6174@163.com 
	> Created Time: 2021年12月13日 星期一 18时15分33秒
 ************************************************************************/

#include<iostream>
#include <string>

class Person
{
public:
	Person() = default;
	Person(std::string p) : action(p) {}

	void setAction(std::string s)
	{
		action = s;
	}

	std::string getAction()
	{
		return action;
	}

	virtual void getConclusion() = 0;

protected:
	std::string action;
};

//具体类
class Man : public Person
{
public:
	using Person::Person;
	virtual void getConclusion()
	{
		if (action == "成功")
			std::cout << "男人" << action << "时，背后多半有一个伟大的女人。" << std::endl;
		else if (action == "失败")
			std::cout << "男人" << action << "时，门头喝酒，谁也不用劝。" << std::endl;
		else if (action == "恋爱")
			std::cout << "男人" << action << "时，凡事不懂也要装懂。" << std::endl;
	}
};

class Woman : public Person
{
public:
	using Person::Person;
	virtual void getConclusion()
	{
		if (action == "成功")
			std::cout << "女人" << action << "时，背后多半有一个不成功的男人。" << std::endl;
		else if (action == "失败")
			std::cout << "女人" << action << "时，眼泪汪汪，谁也劝不了。" << std::endl;
		else if (action == "恋爱")
			std::cout << "女人" << action << "时，遇事懂也装不懂。" << std::endl;
	}
};
